import LocalValue from "../tools/LocalValue";
let LOCAL_SHAKE_FLAG: string = "LOCAL_SHAKE_FLAG";
export default class ShakeManager {

    private static ins: ShakeManager;
    static instance() {
        if (!this.ins) {
            this.ins = new ShakeManager();
        }
        return this.ins;
    }

    private flag: LocalValue;

    /**
     * 
     * @param projectName 项目名称
     */
    init(projectName:string) {
        this.flag = new LocalValue(projectName + LOCAL_SHAKE_FLAG, 1);
    }

 
    getFlag():boolean{
        if (!this.flag) {
            return false;
        }
        let num = this.flag.getValue();
        return num == 1 ? true : false;


    }
  
    setFlag(flag: boolean) {
        if (!this.flag) {
            return;
        }
        let num = flag ? 1 : 0;
        this.flag.setValue(num);
    }
}
